package client;

import java.io.IOException;
import java.net.Socket;

import common.Capabilities;
import common.Connection;
import common.LoginMessage;

public class ClientConnection extends Connection {

    public ClientConnection(String h, int p) throws IOException {
        super(new Socket(h, p));
    }

    public void sendLogin(String u, Capabilities[] able) {
        this.send(new LoginMessage(u, super.getHost(), super.getPort(), true,
                able));
    }

    public void sendSearch(String u) {
        this.send("_SEARCH_\n" + u + "\n_END_");
    }

    public void sendChangeOnline(String u, Boolean o) {
        this.send("_ONLINE_\n" + u + "\n" + (o == true ? true : false)
                + "\n_END_");
    }

}
